<template>
  <div class="tem">
    <div class="tabbar">
      <div v-for="(item,index) in imgData" :key="index"  @click="show(item,index)">
         <router-link :to="item.path" active-class="active">
            <img :src="item.url" alt="" v-if="item.name!=page">
            <img :src="item.url1" alt="" v-if="item.name==page">
           <p>{{item.textline}}</p>
          </router-link>
      </div>
    </div>
    <!-- 路由视图标签 -->
    <router-view></router-view>
  </div>
</template>

<script>
export default {
    name:'tabbar',
    props:['page'],
    data(){
        return {
            // pages:
            imgData:[
                {
                name:'Home',
                imgShow:false,
                url:require('../assets/图标/阅读.png'),
                url1:require('../assets/图标/阅读 (1).png'),
                path:'/home',
                textline:'阅读'
            },
            {
                name:'Bookrack',
                imgShow:false,
                url:require('../assets/图标/发现.png'),
                url1:require('../assets/图标/发现 (1).png'),
                path:'/bookrack',
                textline:'书架'
            },
            {
                name:'Found',
                imgShow:false,
                url:require('../assets/图标/书架.png'),
                url1:require('../assets/图标/书架(1).png'),
                path:'/found',
                textline:'发现'
            },
            {
                name:'Creation',
                imgShow:false,
                url:require('../assets/图标/我的创作.png'),
                url1:require('../assets/图标/我的创作 (1).png'),
                path:'/creation',
                textline:'创作'
            },
            {
                name:'Mine',
                imgShow:false,
                url:require('../assets/图标/我的.png'),
                url1:require('../assets/图标/我的 (1).png'),
                path:'/mine',
                textline:'我的'
            }
      ]
    }
    },
   
     methods: {
        show(item,index){
        //   console.log(item.name);
          console.log(this.page);
        }
 },
}
</script>

<style scoped>
*{
    margin: 0;
    padding: 0;
}
    .tabbar{
      position: fixed;
      bottom:0;
      width: 99%;
      height: 50px;
      display: flex;
      justify-content: space-around;
      background-color: white;
    }
   
  .tabbar>div{
    width: 25%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .tabbar>div>a{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-size: 10px;
    color: grey;
  }
  .tabbar>div>.active{
    color: rgb(98, 189, 189);
  }
  .tabbar>div>a>img{
    width: 30px;
    height: 30px;
  }

</style>